clear;clc
%% parameters
CHANNEL_IN = 0; FREQ_SPAN = 102.4e3; N_LINE = 800; N_AVERAGE = 100;

%% device connection         
sr785=EquipmentControl.SRS.SR785('COM8');

%% acquisition
PDA_CAL_DATA = {};

k = 1;
knob = input('PDA100 knob [dB] (Press ENTER to exit) = ');
while ~isempty(knob)
    PDA_CAL_DATA{k} = sr785.signal_spectrum(CHANNEL_IN, FREQ_SPAN, ...
                                        'line', N_LINE, 'average', N_AVERAGE); %#ok<*SAGROW>
    PDA_CAL_DATA{k}.knob = knob;
    
    knob = input('PDA100 knob [dB] (Press ENTER to exit) = ');
    k = k + 1;
end

%% Plot
figure; 
for k=1:length(PDA_CAL_DATA)
    sr785.plotSpectrum(PDA_CAL_DATA{k});
    hold on;
end

save('PDA100Noise.mat', PDA_CAL_DATA);